/**
 * 全局样式文件
 * 
 * 包含：
 * - 全局重置样式
 * - 通用工具类
 * - 自定义组件样式
 * - 响应式设计
 */

/* ==================== 全局重置样式 ==================== */

/* 导入Ant Design样式 */
@import 'antd/dist/reset.css';

/* 全局字体设置 */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
    'Segoe UI Emoji', 'Segoe UI Symbol';
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 移除默认的链接样式 */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

/* 列表样式重置 */
ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 图片响应式 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==================== 工具类样式 ==================== */

/* 弹性布局 */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

/* 文本对齐 */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* 文本省略 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 间距 */
.m-0 { margin: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }
.mr-1 { margin-right: 8px; }
.mr-2 { margin-right: 16px; }

.p-0 { padding: 0; }
.pt-1 { padding-top: 8px; }
.pt-2 { padding-top: 16px; }
.pt-3 { padding-top: 24px; }
.pb-1 { padding-bottom: 8px; }
.pb-2 { padding-bottom: 16px; }
.pb-3 { padding-bottom: 24px; }
.pl-1 { padding-left: 8px; }
.pl-2 { padding-left: 16px; }
.pr-1 { padding-right: 8px; }
.pr-2 { padding-right: 16px; }

/* 颜色 */
.text-primary {
  color: #1890ff;
}

.text-success {
  color: #52c41a;
}

.text-warning {
  color: #faad14;
}

.text-danger {
  color: #ff4d4f;
}

.text-gray {
  color: #666;
}

.text-light {
  color: #999;
}

/* ==================== 组件样式 ==================== */

/* 页面容器 */
.page-container {
  min-height: calc(100vh - 64px);
  padding: 24px;
  background: #f5f5f5;
}

.page-content {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.card-header {
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

/* 商品卡片 */
.product-card {
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #f5f5f5;
}

.product-info {
  padding: 12px;
}

.product-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
}

.product-price {
  font-size: 18px;
  font-weight: 600;
  color: #ff4d4f;
  margin-bottom: 8px;
}

.product-meta {
  font-size: 12px;
  color: #999;
  display: flex;
  justify-content: space-between;
}

/* 用户头像 */
.user-avatar {
  border-radius: 50%;
  border: 2px solid #f0f0f0;
}

/* 状态标签 */
.status-tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-active {
  background: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.status-sold {
  background: #fff2e8;
  color: #fa8c16;
  border: 1px solid #ffd591;
}

.status-inactive {
  background: #f5f5f5;
  color: #999;
  border: 1px solid #d9d9d9;
}

/* 评分星星 */
.rating-stars {
  color: #fadb14;
}

/* 聊天气泡 */
.chat-bubble {
  max-width: 300px;
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  word-break: break-word;
}

.chat-bubble-sent {
  background: #1890ff;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-bubble-received {
  background: #f5f5f5;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

/* 分页栏全局美化 */
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 32px 0 16px 0;
  width: 100%;
  min-height: 48px;
  background: transparent;
}

/* ==================== 响应式设计 ==================== */

/* 手机端 */
@media (max-width: 768px) {
  .page-container {
    padding: 16px;
  }
  
  .page-content {
    padding: 16px;
    margin: 0 -16px;
    border-radius: 0;
    box-shadow: none;
  }
  
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .product-image {
    height: 150px;
  }
  
  .product-title {
    font-size: 13px;
  }
  
  .product-price {
    font-size: 16px;
  }
}

/* 平板端 */
@media (min-width: 769px) and (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* 桌面端 */
@media (min-width: 1025px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* ==================== 动画效果 ==================== */

/* 淡入动画 */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 滑动动画 */
.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 加载动画 */
.loading-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 深色模式支持 ==================== */

@media (prefers-color-scheme: dark) {
  body {
    background-color: #141414;
    color: #fff;
  }
  
  .page-container {
    background: #141414;
  }
  
  .page-content,
  .card {
    background: #1f1f1f;
    border-color: #303030;
  }
  
  .product-card {
    background: #1f1f1f;
    border-color: #303030;
  }
  
  .product-title {
    color: #fff;
  }
  
  .product-meta {
    color: #999;
  }
} 